


#include "FreeRTOS.h"
#include "task.h"
#include "qe_time.h"
#include "sleep.h"
#include "xil_printf.h"
#include "xuartps_hw.h"
#include "xcoresightpsdcc.h"
#include <stdarg.h>



#define CONFIG_DEBUG_UART   0xFE800000  /* coresightpsdcc */
#define CONFIG_USB_UART1    0xFF010000
#define CONFIG_USB_UART0    0xFF000000


qe_time_t qe_time_ms(void)
{
    TickType_t tick;
    tick = xTaskGetTickCount();
    return (tick*1000/configTICK_RATE_HZ);
}

qe_time_t qe_time(void)
{
    TickType_t tick;
    tick = xTaskGetTickCount();
    return (tick/configTICK_RATE_HZ);
}

void qe_msleep(qe_time_t ms)
{
	vTaskDelay(pdMS_TO_TICKS(ms));
}

void qe_usleep(qe_time_t us)
{
    usleep(us);
}

void qe_date(qe_date_t *date)
{
	qe_second_to_date(qe_time(), date);
}

void qe_putc(char c)
{
	XUartPs_SendByte(CONFIG_USB_UART1, c);
}
